# 定义变量：列表
login_data1 = [
    ["13800000001", "123456", "8888", "登录成功"],
    ["13800000001", "1234", "8888", "密码错误"],
    ["13800000001", "123456", "0000", "验证码错误"]
]
# 定义变量：元组
login_data2 = (
    ("13800000001", "123456", "8888", "登录成功"),
    ("13800000001", "1234", "8888", "密码错误"),
    ("13800000001", "123456", "0000", "验证码错误")
)
# 定义变量：列表元组
login_data3 = [
    ("13800000001", "123456", "8888", "登录成功"),
    ("13800000001", "1234", "8888", "密码错误"),
    ("13800000001", "123456", "0000", "验证码错误")
]
# 定义变量：列表字典 每个元素是一个字典（{key: value} 结构）
login_data4 = [
    {"username": "13800000001", "password": "123456", "code": "8888", "result": "登录成功"},
    {"username": "13800000001", "password": "666666", "code": "8888", "result": "密码错误"},
    {"username": "13800000001", "password": "123456", "code": "0000", "result": "验证码错误"}
]

# 遍历数据3
# for i in login_data3:
#     # print(i)
#     print(f"用户名：{i[0]} 密码：{i[1]} 验证码：{i[2]} 期望结果：{i[3]}")

# 遍历数据4 # 也可以用 i['username'] 获取，区别在于 get() 找不到键时返回 None，而 [] 会报错
for i in login_data4:
    # print(i)
    print(f"用户名：{i.get('username')} 密码：{i.get('password')} "
          f"验证码：{i.get('code')} 期望结果：{i.get('result')}")
    # print(f"用户名：{i['username']}")







